<template>
	<!--选择责任代码-->
	<el-dialog title="选择父级责任" :visible.sync="dialogVisible" size="small" :close-on-click-modal="false" :close-on-press-escape="false" :before-close="off">
		  <el-form label-width="150px" >
		  <el-row :span="24">
		  	<el-form-item label="父级责任" label-width="150px" :span="24">
				<el-select v-model="owneritemcode"  placeholder="责任代码" filterable size="small" style="width:80%">
					<el-option v-for="item in itemOptions" :key="item.itemcode" :label="item.itemcode +  '-' + item.itemcname" :value="item.itemcode"></el-option>
				</el-select>
			</el-form-item>
		  </el-row>
		</el-form>
		  <span slot="footer" class="dialog-footer">
			   <el-button @click="off">取 消</el-button>
			   <el-button type="success" @click="select">确 定</el-button>
		  </span>
	</el-dialog>
</template>

<script>
import ItemAPI from "../../../../js/production/item/itemAPI";
export default {
	data() {
		return {
			dialogVisible: true,
			owneritemcode : '',
			currentItemCode : '',
			itemOptions : [],
		}
	},
	mounted() {
		this.currentItemCode = this.$parent.currentItemCode;
		ItemAPI.queryItemByParent(this);
	},
	methods: {
		select() {
			this.$parent.tempItemCode = this.owneritemcode;
			this.$parent.tempId = this.currentItemCode;
			this.off();
		},
		off() {
			this.$parent.showOwnerItemSelect = false;
		}
	}
  }
</script>